# Maintainer: Dave Henderson <dhenderson@gmail.com>
pkgname=gomplate
_goname="github.com/hairyhenderson/$pkgname"
pkgver=3.7.0
pkgrel=0
pkgdesc="A versatile Go template processor"
url="https://github.com/hairyhenderson/gomplate"
arch="all !s390x !mips !mips64" # FAIL: TestCreateContext with SIGSEGV
license="MIT"
depends="ca-certificates"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"
builddir="$srcdir/src/$_goname"

prepare() {
	mkdir -p "${builddir%/*}"
	mv "$srcdir"/$pkgname-$pkgver "$builddir"/

	default_prepare
}

build() {
	make build \
		GOPATH="$srcdir" \
		VERSION="$pkgver" \
		COMMIT="unknown"
}

check() {
	# Note: make test (that runs go test -race) doesn't work.
	GOPATH="$srcdir" go test -v
}

package() {
	install -D -m 755 bin/gomplate "$pkgdir"/usr/bin/gomplate
}

cleanup_srcdir() {
	[ -d src ] && chmod -R +w src
	default_cleanup_srcdir
}

sha512sums="e0f0f4afe4bf32533bbfa8c56e2190c55a2a632beda3ba1ebfe2f99bf6128ffb5659a65e0966700fd5b3fb8e908fdbc2f3cadc9aa7ca465ae5b5fcff9cfe9b57  gomplate-3.7.0.tar.gz"
